﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="js操作Select制作联动菜单.aspx.cs" Inherits="Dom_jsSelectmenu" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>js操作Select制作联动菜单</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <select id="select1" size="8" name="select1" onchange="uu(this.value)">
            <option></option>
            <option value="bb">aa</option>
            
        </select>
        <select id="Select2" size="8" name="Select2" onchange="se();alert(this.value)">
            <option></option>
        </select>
        <select id="Select3" size="8" name="Select3" >
            <option></option>
        </select>
        
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Services>
            <asp:servicereference Path="~/35newpart/OptionWcf.svc " />
            </Services>
        </asp:ScriptManager>
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
        
        
        </div>
        
<script type="text/javascript">
//test 添加选项
//添加一个原素
document.getElementById("select1").options.add(new Option( "-----请选择-----","111"),0);
var select2 = document.getElementById("Select2");//第二个对象
var select3= document.getElementById("Select3");
    var arr = new Array();
     arr =  Dom_jsSelectmenu.uuu().value.split(',');
//第二个操作的事件
function se()
{
    select3.options.length =0;//这里把数据设定为0
     for(i=0;i<arr.length;i++)
     {
        //alert(arr[i]);
        select3.options.add(new Option(arr[i],arr[i]));
     }
}

function uu ()
{

     
     for(i=0;i<arr.length;i++)
     {
        //alert(arr[i]);
        select2.options.add(new Option(arr[i],arr[i]));
     }
}
</script>
    </form>
    
</body>
</html>
